<?php
class Menu extends PageElement
{
	protected $postVariableName;
	protected $menuItems;

	public function setMenuItems($menuItems)
	{
		$this->menuItems = $menuItems;
	}

	public function getHTML()
	{
		$html = "<script language=\"javascript\">\n";
		$html .= "function setHover(object)\n";
		$html .= "		{\n";
		$html .= "			(document.getElementById(object)).className=\"mainmenuitemhover\";\n";
		$html .= "		}\n";
		$html .= "function unsetHover(object)\n";
		$html .= "		{\n";
		$html .= "			(document.getElementById(object)).className=\"mainmenuitem\";\n";
		$html .= "		}\n";
		$html .= "</script>\n";

		$html .= "<table><tr>\n";
		foreach($this->menuItems as $menuItem)
		{
			$html .= "<td class='mainmenuitem' id='".$menuItem->getPostValue()."'  \n";
			$html .= "onclick='submitFormPostData(\"Action\",\"".$menuItem->getPostValue()."\");' \n";
			$html .= "onmouseOver='setHover(\"".$menuItem->getPostValue()."\");' \n";
			$html .= "onmouseOut='unsetHover(\"".$menuItem->getPostValue()."\");' >\n";
//			$html .= "<a class=\"menu\">".$menuItem->getText()."</a></td>\n";
			$html .= $menuItem->getText()."</td>\n";
		}
		$html .= "</tr></table>";
		return $html;

	}

}